<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace Home\Controller;
use OT\DataDictionary;

/**
 * 前台首页控制器
 * 主要获取首页聚合数据
 */
class IndexController extends HomeController {

	//系统首页
    public function index(){

//        $category = D('Category')->getTree();
//        $lists    = D('Document')->lists(null);
//
//        $this->assign('category',$category);//栏目
//        $this->assign('lists',$lists);//列表
//        $this->assign('page',D('Document')->page);//分页

        $this->display('WebSite/index');
    }
    public function article(){
        // 获得文章
        $lists    = D('Document')->lists(2);
        foreach ($lists as$key=> $val){
            $lists[$key]['cover_path']=get_cover($val['cover_id'],'path');
        }
        
        $this->ajaxReturn($lists);

    }
    public function consult(){
        // 获得资讯
        $lists    = D('Document')->lists(39);
        foreach ($lists as$key=> $val){
            $lists[$key]['cover_path']=get_cover($val['cover_id'],'path');
        }

        $this->ajaxReturn($lists);

    }
    public function weixin(){
        // 获得产品展示的微信数据
        $lists    = D('Document')->lists(42);
        foreach ($lists as$key=> $val){
            $lists[$key]['cover_path']=get_cover($val['cover_id'],'path');
        }

        $this->ajaxReturn($lists);

    }
    public function info(){
        // 获得产品展示的平台数据
        $lists    = D('Document')->lists(43);
        foreach ($lists as$key=> $val){
            $lists[$key]['cover_path']=get_cover($val['cover_id'],'path');
        }

        $this->ajaxReturn($lists);

    }
    public function pro(){
        // 获得产品展示的平台数据
        $id =I('id');
        $info=D('document')->detail($id);

        $this->ajaxReturn($info);

    }
    public function myInfo(){
        // 获得产品展示的平台数据
        $lists = D('Document')->limit(4)->lists(44);
        foreach ($lists as$key=> $val){
            $lists[$key]['cover_path']=get_cover($val['cover_id'],'path');
        }

        $this->ajaxReturn($lists);

    }
    public function top(){
        // 获得产品展示的平台数据
        $lists  = D('Document')->where('istop=1')->limit(4)->select();
        foreach ($lists as$key=> $val){
            $lists[$key]['cover_path']=get_cover($val['cover_id'],'path');
        }

        $this->ajaxReturn($lists);

    }
}